<?php
	header("Content-Type: text/html;charset=utf-8");
	include("function/_nosql.php"); //
	include("function/function.php");
	$kboy_userid = $_SESSION['kboy_userid'];
	$kboy_user = $_SESSION['kboy_user'];
	
	$uid = chkstr(trim($_REQUEST['uid']));
	$ac = chkstr(trim($_REQUEST['ac']));
	if(empty($uid)){
		echo erro("参数错误");
	}
	if(!is_numeric($uid)){
		echo erro("参数错误");
	}
	if(getNewsNums("kboy_user","uid=$uid") <1){
		echo erro("参数错误");
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>互动留言_社区_<?= $web_titles ?></title>
<meta name="Keywords" content="互动留言,社区,<?= $web_keywords ?>" />
<meta name="Description" content="<?= $web_description ?>" />
<link rel="stylesheet" href="css/common.css"/>
<link rel="stylesheet" href="css/sq.css"/>
<script type="text/javascript" src="js/baidutongji.js"></script>
<script type="text/javascript" src="js/laydate/laydate.js"></script>
</head>
<body>
    <!--top-bar begin-->
	<? include("_include.top.topbar.php") ?>
    <!--top-bar end-->
    <!--header begin-->
	<? include("_include.top.navbar.php") ?>
    <!--header end-->
    <!--banner begin-->
	<? include("_include.forum.banners.php") ?>
    <!--banner end-->
    <!--活动 begin-->
    <div class="sq-wrap">
		<? include("_include.forum.title.php") ?>
        <div class="sq-bd">
			<? include("_include.forum.topnav.php") ?>
            <div class="sq-bd-con">
                <div class="post-container">
                    <form action="forum_messagesave.php?action=add" method="post">
                        <div class="sq-editor-cont">
                            <div class="sq-editor-text">
                                <div contenteditable="true" class="textarea">说点什么吧</div>
                                <input class="textarea-hidden" type="hidden" name="strhtml" />
                            </div>
                            <div class="sq-editor-ft">
                                <div class="sq-editor-attach">
                                    <ul>
                                        <li>
                                            <a href="javascript:;">
                                                图片
                                                <i class="icon icon-pic"></i>
                                                <input type="file" name='imgFile' class="btn-img-upload" />
                                            </a>
                                        </li>
                                        <li><a class="btn-link-append" href="javascript:;">超链接<i class="icon icon-link"></i></a></li>
                                    </ul>
                                </div>
                                <div class="sq-editor-op"><a href="javascript:void(0)" class="btn-post"><i class="icon icon-post"></i>发 表</a></div>
                            </div>
                            <div class="sq-editor-pics">
                                <ul class="clearfix">
                                </ul>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="fn-feed-container">
                    <div class="feed-inner">
                        <ul class="feed_friend_list">
						<?php
								$SQL = "";
								$pagesize = 10; // 分页数量
								$pageval = chkstr(trim($_REQUEST['page'])); // 获取Page的值
								if($pageval){
									if(!is_numeric($pageval)){
										echo erro("Page Error");
									}
									if($pageval <= 1){
										$pageval = 1;
									}
									$page = ($pageval-1) * $pagesize;
									$page .= ",";
								}else{
									$pageval = 1;
								}
								
								$pagesql = "select * from kboy_forum_message where tid=$uid order by id desc";
								$pagenum = mysql_num_rows(mysql_query($pagesql)); // 总记录数
								$pagecount = ceil($pagenum/$pagesize); // 共分多少页
								if($pageval > $pagecount){
									$pageval = $pagecount;
								}
								
								$news_sql = $pagesql." limit $page $pagesize";
								$news_rows = mysql_query($news_sql);
								$i = 1;
								while($news_rs = mysql_fetch_assoc($news_rows)){
								
									$content = json_decode($news_rs['message_text']);
								//	var_dump($content);
						?>
							<li class="f-single">
                                <div class="f-aside">
                                    <div class="f-user-pto">
                                        <a href="forum_news.php?uid=<?=$news_rs['uid']?>" target="_blank">
											<?php
												$pic = getClassName('kboy_user','user_face','uid='.$news_rs['tid']);
												if($pic){
													$member_pic = $pic;
												}else{
													$member_pic = "images/f_pic1_6.jpg";
												}
											?>
                                            <img src="<?php echo $member_pic;?>" width="58" height="58" alt=""/>
                                        </a>
                                    </div>
                                    <div class="f-user-info">
                                        <div class="f-nick"><a href="forum_news.php?uid=<?=$news_rs['tid']?>"><?php echo getUserNickName($news_rs['tid']);?></a></div>
                                        <div class="info-detail">
                                            <span class="time"><?php echo $news_rs['news_addtime']?></span>
                                            <span class="state"><i class="icon-browse"></i>浏览(0)</span>
                                        </div>
                                    </div>
                                </div>
                                <div class="f-wrap">
                                    <div class="f-item">
                                        <div class="f-info"><?php echo $content->message_text;?></div>
                                        <div class="sq_summary">
										<?php
											if(count($content->images)){
										?>
                                            <div class="f-ct">
                                                <div class="img-box-wrap">
                                                    <div class="img-box">
														<?php
														
															foreach($content->images as $v){
																echo "<a href='javascript:;' class='img-two'><img src='".$v."' /></a>";
															}
														?>
                                                        
                                                    </div>
                                                </div>
                                            </div>
										<?php
											}
										?>
                                            <div class="f-op-wrap">
                                                <div class="f-detail">
												<?php
													getSoonIDList($news_rs['id'],'kboy_forum_message');
													$soon = ltrim($getSoonIDList,',');
												?>
                                                    <a class="f-detail-comment" href="javascript:void(0);"><i class="ui-icon icon-comment"></i>回复(<?php echo count(explode(',',$soon));?>)</a>
													
                                                        <a class="f-detail-praise" href="forum_message_zandel.php?action=dianzan&id=<?=$news_rs['id']?>" data-id="<?php echo $news_rs['id']?>" ><i class="ui-icon icon-praise"></i>赞(<span class="num"><?=$news_rs['message_good']?></span>)</a>
													
													
                                                   <!-- <a class="f-detail-collect" href="server/test.php?action=shoucang"><i class="ui-icon icon-collect"></i>收藏</a>-->
													<?php 
														if($kboy_userid == $uid){
															//echo "<a class='f-detail-delete' href='server/test.php?action=shanchu&id=".$news_rs['id']."'><i class='ui-icon icon-delete'></i>删除</a>";
															echo "<a class='f-detail-delete' href='forum_message_zandel.php?action=shanchu&id=".$news_rs['id']."'  ><i class='ui-icon icon-delete'></i>删除</a>";
														}
														
													?>
                                                    
                                                </div>
												<?php
													if(getNewsNums('kboy_forum_message',"pid = ".$news_rs['id'])){
												?>
												
												<div class="mod-comments">
                                                        <div class="comments-list ">
                                                            <ul>
															
															<?php
																$com_sql = "select * from kboy_forum_message where pid = ".$news_rs['id'];
																$com_re = mysql_query($com_sql);
																while($com_arr = mysql_fetch_assoc($com_re)){
																
															?>	
															
																<li class="comments-item bor3">
                                                                    <div class="comments-item-bd">
                                                                        <div class="ui-avatar">
                                                                            <a href="#" target="_blank">
																			<?php
																				$pic = getClassName('kboy_user','user_face','uid='.$com_arr['uid']);
																				if($pic){
																					$member_pic = $pic;
																				}else{
																					$member_pic = "images/f_pic1_6.jpg";
																				}
																			?>
                                                                                <img class="q_namecard" src="<?php echo $member_pic;?>">
                                                                            </a>
                                                                        </div>
                                                                        <div class="comments-content">
                                                                            <a class="c_tx" target="_blank" href="#"><?php echo getUserNickName($com_arr['uid']);?></a>&nbsp; : <?php echo $com_arr['message_text'];?>
                                                                            <div class="comments-op">
                                                                                <span class=" ui-mr10 state"><?php echo $com_arr['message_addtime'];?></span>
                                                                                <a class="act-reply" href="javascript:;"><b class="hide-clip">回复</b></a>
																				<!--
                                                                                <a class="act-delete none" href="server/test.php?action=delchildmsg"><b class="hide-clip">删除</b></a>
																				-->
                                                                            </div>
                                                                        </div>
                                                                        <div class="comment-box-wrap">
																			<form action="forum_messagesave.php?action=reply&pid=<?php echo $com_arr['id'];?>" method="post">
																				<div class="sq-editor-cont">
																					<div class="sq-editor-text">
																						<div contenteditable="true" class="textarea"></div>
																						<input class="textarea-hidden" type="hidden"  name="strhtml" />
																					</div>
																					<div class="sq-editor-ft">
																						<div class="sq-editor-attach">
																							<ul>
																								<li><a class="btn-link-append" href="javascript:;">超链接<i class="icon icon-link"></i></a></li>
																							</ul>
																						</div>
																						<div class="sq-editor-op"><input type="submit" value="发表" class='btn-post' ></div>
																					</div>
																				</div>
																			</form>
                                                                        </div>
																		
																		
																		<?php echo getComLists($com_arr['id'],'kboy_forum_message','forum_messagesave.php');?>
																		
																		
                                                                    </div>
                                                                </li>
															<?php	
																}
															?>
                                                                
																
																
                                                            </ul>
                                                         </div>
                                                        
                                                    </div>
												<?php
													}
												?>
												
												
												
                                                <div class="mod-comments">
                                                    <div class="mod-commnets-poster">
                                                        <div class="comments-box" >
                                                            <div class="text-input"><a href="javascript:;" class="sq-tx">我也说一句</a></div>
                                                            <div class="mod-insert-mess"><a href="javascript:;"><i class="icon icon-mess"></i></a></div>
                                                        </div>
                                                        <div class="comment-box-wrap">
                                                            <form action="forum_messagesave.php?action=reply&pid=<?php echo $news_rs['id'];?>" method="post">
                                                                <div class="sq-editor-cont">
                                                                    <div class="sq-editor-text">
                                                                        <div contenteditable="true" class="textarea"></div>
                                                                        <input class="textarea-hidden" type="hidden" name="strhtml" />
                                                                    </div>
                                                                    <div class="sq-editor-ft">
                                                                        <div class="sq-editor-attach">
                                                                            <ul>
                                                                                <li><a class="btn-link-append" href="javascript:;">超链接<i class="icon icon-link"></i></a></li>
                                                                            </ul>
                                                                        </div>
                                                                        <div class="sq-editor-op"><a href="javascript:void(0)" class="btn-post">发表</a></div>
                                                                    </div>
                                                                </div>
                                                            </form>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </li>
						
						
                            
							
						<?php
								}
						?>
                        </ul>
                        <!-- <div class="s-watch-more">
                            <a href="javascript:;">
                                <span>查看更多</span>
                                <i></i>
                            </a>
                        </div> -->
                        <?php
								if($pagenum > $pagesize){
									echo "<div class=\"pagination\"><ul>";
									$url = "forum_message.php?uid=$uid";//当前页面
									pagebar($pagecount, $pageval, 7, $url);
									echo "</ul></div>";
								}
						?>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--foot begin-->
	<? include("_include.bottom.footbar.php") ?>
    <!--foot begin-->
    <!--左侧悬浮 begin-->
	<? include("_include.bottom.leftbar.php") ?>
    <!--左侧悬浮 end-->
    <!--右侧悬浮导航 begin-->
	<? include("_include.bottom.rightbar.php") ?>
    <!--右侧悬浮导航 end-->
    <script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="js/jquery.SuperSlide.2.1.1.js"></script>
    <script type="text/javascript" src="layer/layer.js"></script>
    <script type="text/javascript" src="piclayer/piclayer.min.js"></script>
    <script src="js/jquery.ui.widget.js"></script>
    <script src="js/jquery.iframe-transport.js"></script>
    <script src="js/jquery.fileupload.js"></script>
 
    <script type="text/javascript" src="js/main.js"></script>
    <script type="text/javascript" src="js/sq.js"></script>
    <script>
        ;!function(){
            piclayer.use('extend/piclayer.ext.js', function(){
                //初始加载即调用，所以需放在ext回调里
                piclayer.ext = function(){
                    piclayer.photosPage({
                        parent:'.img-box'
                    });
                };
            });
        }();
    </script>
	
	<script type="text/javascript">
		$(function(){
			$('.btn-post').click(function(){
				
			});
		});
	</script>
</body>
</html>

